#!/bin/sh -e
# Copy the *.dtbo's into the initramfs
 
if [ "$1" = "prereqs" ]; then exit 0; fi
 
. /usr/share/initramfs-tools/hook-functions
 
if [ -d /lib/firmware/ ] ; then
    unset check
    check=$(ls /lib/firmware/ | grep am335x-pru | head -n 1)
    if [ ! "x${check}" = "x" ] ; then
        mkdir -p $DESTDIR/lib/firmware/
        if [ -f /lib/firmware/am335x-pru0-fw ] ; then
            cp -a /lib/firmware/am335x-pru0-fw $DESTDIR/lib/firmware/
        fi
        if [ -f /lib/firmware/am335x-pru1-fw ] ; then
            cp -a /lib/firmware/am335x-pru1-fw $DESTDIR/lib/firmware/
        fi
    fi
fi
